 Object.prototype.extend = function() {
     var hasOwnProperty = Object.hasOwnProperty;
     var object = Object.create(this);
     var length = arguments.length;
     var index = length;
     while (index) {
         var extension = arguments[length - (index--)];
         for (var property in extension) {
             if (hasOwnProperty.call(extension, property) || typeof object[property] === 'undefined') {
                 if (object[property] !== 'undefined') {
                     if (override) {
                         deepClone(extension[property], object[property]);
                     }
                 } else {
                     deepClone(extension[property], object[property]);
                 }
             }
         }
     }
     return object;
 };


 /* 复制对象 */
 function deepClone(item) {
     if (!item) {
         return item;
     } // null, undefined values check  
     var types = [Number, String, Boolean],
         result;

     types.forEach(function(type) {
         if (item instanceof type) {
             result = type(item);
         }
     });

     if (typeof result == "undefined") {
         if (Object.prototype.toString.call(item) === "[object Array]") {
             result = [];
             item.forEach(function(child, index, array) {
                 result[index] = deepClone(child);
             });
         } else if (typeof item == "object") {
             if (item.nodeType && typeof item.cloneNode == "function") {
                 var result = item.cloneNode(true);
             } else if (!item.protoype) {
                 result = {};
                 for (var i in item) {
                     result[i] = deepClone(item[i]);
                 }
             } else {
                 // 这里解决的是带钩子函数的情况,深的话,去掉那个false &&,浅的,维持原有的引用
                 if (false && item.constructor) {
                     result = new item.constructor();
                 } else {
                     result = item;
                 }
             }
         } else {
             result = item;
         }
     }
     return result;
 }